<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./jquery-1.9.1.min.js"> </script>
</head>
<body>
   <input type="button" value="点击我"> 
   <div id="box"></div>
   <script>
    //    默认是get提交
    //    $(function(){
    //        $('input').on('click',function(){
    //            $('#box').load('test.html .txt1')
    //        })
    //    })
    // http://127.0.0.1:5500/18ajax/test.html?name=Donald&town=Ducktown 数据问好传参自动拼接到url去。
        $(function(){
            $('input').on('click',function(){
                $.get('1.json',{ name:"Donald", town:"Ducktown" },function(res,status){
                    console.log(res,)
                    console.log(res instanceof Array)
                    $('#box').text(JSON.stringify(res))
                })
            })
        })

   </script>
</body>
</html>